$_SESSION['loggedIn']=1; // Set user as logged in $_SESSION['user']=$username; //Store Users Name session_start(); // Resume up your PHP session! if(isset($_SESSION['user'])){ $username=$_SESSION['user']; } if(!isset($_SESSION['loggedIn'])){ echo 'No Authorization'.$username; exit; }